/*!
 * \file t__split_eq_string.c
 *
 * All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.\n
 *
 * \version 3.0
 * \author geyh
 * \date 2016/03/31
 *
 */
#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"
#include "frlist.h"
#include "frhash2.h"
#include "conntrack.h"
#include "frct_comm.h"

#include "apmtest_comm.h"

static int __suite_init(void)
{

    return 0;
}

static int __suite_cleanup(void)
{

    return 0;
}

static void __case1(void)
{
    Frhash_header *p_hash_hdr = NULL;
    unsigned long ul_hash_size = 0;
    int i_ret = 0;

    i_ret = frhash2_create(p_hash_hdr, ul_hash_size);

    CU_ASSERT_EQUAL(i_ret,FR_FAIL);

}

static void __case2(void)
{
    Frhash_header *p_hash_hdr;

    unsigned long ul_hash_size = 0;
    int i_ret = 0;

    p_hash_hdr = (Frhash_header *)frmalloc(sizeof(Frhash_header));

    i_ret = frhash2_create(p_hash_hdr, ul_hash_size);

    CU_ASSERT_EQUAL(i_ret,FR_FAIL);

    frfree(p_hash_hdr);
}

static void __case3(void)
{
    Frhash_header *p_hash_hdr;
    unsigned long ul_hash_size = 10;
    int i_ret = 0;

    p_hash_hdr = (Frhash_header *)frmalloc(sizeof(Frhash_header));

    i_ret = frhash2_create(p_hash_hdr, ul_hash_size);

    CU_ASSERT_EQUAL(i_ret,FR_SUCC);

    frfree(p_hash_hdr->p_list_array);
    frfree(p_hash_hdr);

}

int add_suite_frhash2_create(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite("frhash2 frhash2_create()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    CU_add_test(pSuite, "case1", __case1);
    CU_add_test(pSuite, "case2", __case2);
    CU_add_test(pSuite, "case3", __case3);

    return FR_SUCC;
}
